<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">
<h:head>
	<title>SCA - Pesquisa de Cliente</title>
</h:head>
<h:body>
	<h:form>

		<p:dataTable var="cliente" value="#{clienteBean.listaClientes}">
			<p:column headerText="ID">
				<h:outputText value="#{cliente.id}" />
			</p:column>
			<p:column headerText="Nome">
				<h:outputText value="#{cliente.pessoaFisica.pessoa.nome}" />
			</p:column>
			<p:column headerText="Rua">
				<h:outputText value="#{cliente.pessoaFisica.pessoa.rua}" />
			</p:column>

		</p:dataTable>
		<f:facet name="footer">
		<p:commandButton id="edit" value="Editar" icon="ui-icon-pencil"
						update=":formEdit" oncomplete="editarCliente.show()"/>
		
		</f:facet>
		
	<p:dialog widgetVar="editarCliente" modal="true"
		header="Editar Cliente">
		<h:form id="formEdit">

			<p:growl id="growl" sticky="true" showDetail="true" />

			<h:panelGrid columns="2" cellspacing="15">


				<h:outputText value="Nome: " />
				<p:inputText value="#{ClienteBean.cliente.pessoaFisica.pessoa.nome}" />

				<h:outputText value="CPF: " />
				<p:inputText value="#{ClienteBean.cliente.pessoaFisica.cpf}" />

				<h:outputText value="Idade: " />
				<p:inputText value="#{ClienteBean.cliente.pessoaFisica.idade}" />

				<h:outputText value="Sexo: " />
				<p:inputText value="#{ClienteBean.cliente.pessoaFisica.sexo}" />

				<h:outputText value="Estado: " />
				<p:inputText
					value="#{ClienteBean.cliente.pessoaFisica.pessoa.estado}" />

				<h:outputText value="Rua: " />
				<p:inputText value="#{ClienteBean.cliente.pessoaFisica.pessoa.rua}" />

				<h:outputText value="CEp: " />
				<p:inputText value="#{ClienteBean.cliente.pessoaFisica.pessoa.cep}" />

				<h:outputText value="Email: " />
				<p:inputText value="#{ClienteBean.cliente.pessoaFisica.email}" />


				<p:commandButton actionListener="#{ClienteBean.alterar()}"
					update=":form" oncomplete="editarCliente.hide()"
					value="Salvar Alterações" icon="ui-icon-circle-check" />
			</h:panelGrid>

		</h:form>
	</p:dialog>

	</h:form>
</h:body>
</html>

